﻿namespace PMS.Client.FrmJobPosition
{
    using PMS.BLL;
    using PMS.Client.FrmUserType;
    using PMS.Common;
    using PMS.Model;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FrmJobPositionUpdate : Form
    {
        private Button btnCancel;
        private Button btnJobPosition1;
        private Button btnJobPosition2;
        private Button btnSave;
        private Button btnUserType;
        private IContainer components = null;
        private GroupBox groupBox1;
        private GroupBox groupBox3;
        private TextBox JobPosition1;
        private TextBox JobPosition2;
        private DateTimePicker jpd2;
        private DateTimePicker jpdate1;
        private Label label1;
        private Label label2;
        private Label label24;
        private Label label25;
        private Label label26;
        private Label label27;
        private Label label29;
        private Label label31;
        private Label label32;
        private Label label33;
        private Label label34;
        private Label label8;
        private Label lbTitle;
        private UserChangeLog log = null;
        private UserChangeLogBLL logbll = new UserChangeLogBLL();
        private TextBox txtAdminPosition;
        private DateTimePicker txtDate;
        private TextBox txtID;
        private TextBox txtNo;
        private TextBox txtRemark;
        private TextBox txtSummary;
        private TextBox txtUsername;
        private User user = null;
        private UserBLL userbll = new UserBLL();
        private int userid = 0;
        private TextBox UserType;

        public FrmJobPositionUpdate(int userid)
        {
            this.userid = userid;
            this.InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnJobPosition1_Click(object sender, EventArgs e)
        {
            PMS.Client.FrmJobPosition.FrmSelect select = new PMS.Client.FrmJobPosition.FrmSelect();
            select.ShowDialog();
            if (select.DialogResult == DialogResult.OK)
            {
                this.JobPosition1.Text = select.JobPosition;
            }
        }

        private void btnJobPosition2_Click(object sender, EventArgs e)
        {
            PMS.Client.FrmJobPosition.FrmSelect select = new PMS.Client.FrmJobPosition.FrmSelect();
            select.ShowDialog();
            if (select.DialogResult == DialogResult.OK)
            {
                this.JobPosition2.Text = select.JobPosition;
            }
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            UserChangeLog log = new UserChangeLog {
                JobPositionName1 = this.JobPosition1.Text,
                JobPositionDate1 = new DateTime?(this.jpdate1.Value),
                JobPositionName2 = this.JobPosition2.Text,
                JobPositionDate2 = new DateTime?(this.jpd2.Value),
                JobPositionDate = new DateTime?(this.txtDate.Value),
                JobPositionNo = this.txtNo.Text,
                JobPositionSummary = this.txtSummary.Text,
                JobPositionRemark = this.txtRemark.Text,
                JobPositionType = this.UserType.Text,
                AdminPosition = this.txtAdminPosition.Text,
                UserID = this.user.UserID,
                UpdateDate = new DateTime?(DateTime.Now),
                UpdateUser = PMS.Common.Keys.Admin.LoginName,
                LogType = "任职",
                CheckState = "未审核"
            };
            this.log = log;
            if (new UserChangeLogBLL().Add(this.log) > 0)
            {
                MessageBox.Show("任职成功，等待审核中！");
                base.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("任职失败！");
            }
        }

        private void btnUserType_Click(object sender, EventArgs e)
        {
            PMS.Client.FrmUserType.FrmSelect select = new PMS.Client.FrmUserType.FrmSelect();
            select.ShowDialog();
            if (select.DialogResult == DialogResult.OK)
            {
                this.UserType.Text = select.UserType;
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FrmJobTitleUpdate_Load(object sender, EventArgs e)
        {
            this.user = this.userbll.GetModel(this.userid);
            this.txtUsername.Text = this.user.UserName;
            this.txtID.Text = this.user.ID;
            this.JobPosition1.Text = this.user.JobPositionName1;
            this.jpdate1.Value = !this.user.JobPositionDate1.HasValue ? DateTime.Now : this.user.JobPositionDate1.Value;
            this.JobPosition2.Text = this.user.JobPositionName2;
            this.jpd2.Value = !this.user.JobPositionDate2.HasValue ? DateTime.Now : this.user.JobPositionDate2.Value;
            this.txtDate.Value = !this.user.JobPositionDate.HasValue ? DateTime.Now : this.user.JobPositionDate.Value;
            this.txtNo.Text = this.user.JobPositionNo;
            this.txtSummary.Text = this.user.JobPositionSummary;
            this.txtRemark.Text = this.user.JobPositionRemark;
            this.UserType.Text = this.user.JobPositionType;
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(FrmJobPositionUpdate));
            this.groupBox3 = new GroupBox();
            this.btnUserType = new Button();
            this.UserType = new TextBox();
            this.btnJobPosition2 = new Button();
            this.JobPosition2 = new TextBox();
            this.btnJobPosition1 = new Button();
            this.JobPosition1 = new TextBox();
            this.txtDate = new DateTimePicker();
            this.label2 = new Label();
            this.txtRemark = new TextBox();
            this.label26 = new Label();
            this.txtSummary = new TextBox();
            this.label25 = new Label();
            this.txtNo = new TextBox();
            this.label24 = new Label();
            this.txtAdminPosition = new TextBox();
            this.label34 = new Label();
            this.jpd2 = new DateTimePicker();
            this.label32 = new Label();
            this.label33 = new Label();
            this.jpdate1 = new DateTimePicker();
            this.label31 = new Label();
            this.label29 = new Label();
            this.label27 = new Label();
            this.groupBox1 = new GroupBox();
            this.txtID = new TextBox();
            this.label1 = new Label();
            this.txtUsername = new TextBox();
            this.label8 = new Label();
            this.btnCancel = new Button();
            this.btnSave = new Button();
            this.lbTitle = new Label();
            this.groupBox3.SuspendLayout();
            this.groupBox1.SuspendLayout();
            base.SuspendLayout();
            this.groupBox3.Controls.Add(this.btnUserType);
            this.groupBox3.Controls.Add(this.UserType);
            this.groupBox3.Controls.Add(this.btnJobPosition2);
            this.groupBox3.Controls.Add(this.JobPosition2);
            this.groupBox3.Controls.Add(this.btnJobPosition1);
            this.groupBox3.Controls.Add(this.JobPosition1);
            this.groupBox3.Controls.Add(this.txtDate);
            this.groupBox3.Controls.Add(this.label2);
            this.groupBox3.Controls.Add(this.txtRemark);
            this.groupBox3.Controls.Add(this.label26);
            this.groupBox3.Controls.Add(this.txtSummary);
            this.groupBox3.Controls.Add(this.label25);
            this.groupBox3.Controls.Add(this.txtNo);
            this.groupBox3.Controls.Add(this.label24);
            this.groupBox3.Controls.Add(this.txtAdminPosition);
            this.groupBox3.Controls.Add(this.label34);
            this.groupBox3.Controls.Add(this.jpd2);
            this.groupBox3.Controls.Add(this.label32);
            this.groupBox3.Controls.Add(this.label33);
            this.groupBox3.Controls.Add(this.jpdate1);
            this.groupBox3.Controls.Add(this.label31);
            this.groupBox3.Controls.Add(this.label29);
            this.groupBox3.Controls.Add(this.label27);
            this.groupBox3.Location = new Point(12, 0x69);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new Size(0x1fd, 0x106);
            this.groupBox3.TabIndex = 4;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "职务";
            this.btnUserType.BackColor = Color.Gainsboro;
            this.btnUserType.FlatAppearance.BorderColor = Color.DimGray;
            this.btnUserType.FlatStyle = FlatStyle.Flat;
            this.btnUserType.Location = new Point(0xbd, 0x48);
            this.btnUserType.Name = "btnUserType";
            this.btnUserType.Size = new Size(0x15, 0x15);
            this.btnUserType.TabIndex = 0x41;
            this.btnUserType.Text = "…";
            this.btnUserType.UseVisualStyleBackColor = false;
            this.btnUserType.Click += new EventHandler(this.btnUserType_Click);
            this.UserType.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.UserType.BorderStyle = BorderStyle.FixedSingle;
            this.UserType.Location = new Point(0x4a, 0x48);
            this.UserType.Name = "UserType";
            this.UserType.ReadOnly = true;
            this.UserType.Size = new Size(0x87, 0x15);
            this.UserType.TabIndex = 0x3f;
            this.btnJobPosition2.BackColor = Color.Gainsboro;
            this.btnJobPosition2.FlatAppearance.BorderColor = Color.DimGray;
            this.btnJobPosition2.FlatStyle = FlatStyle.Flat;
            this.btnJobPosition2.Location = new Point(0xbd, 0x2d);
            this.btnJobPosition2.Name = "btnJobPosition2";
            this.btnJobPosition2.Size = new Size(0x15, 0x15);
            this.btnJobPosition2.TabIndex = 0x3e;
            this.btnJobPosition2.Text = "…";
            this.btnJobPosition2.UseVisualStyleBackColor = false;
            this.btnJobPosition2.Click += new EventHandler(this.btnJobPosition2_Click);
            this.JobPosition2.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.JobPosition2.BorderStyle = BorderStyle.FixedSingle;
            this.JobPosition2.Location = new Point(0x4b, 0x2d);
            this.JobPosition2.Name = "JobPosition2";
            this.JobPosition2.Size = new Size(0x87, 0x15);
            this.JobPosition2.TabIndex = 0x3d;
            this.btnJobPosition1.BackColor = Color.Gainsboro;
            this.btnJobPosition1.FlatAppearance.BorderColor = Color.DimGray;
            this.btnJobPosition1.FlatStyle = FlatStyle.Flat;
            this.btnJobPosition1.Location = new Point(0xbd, 0x11);
            this.btnJobPosition1.Name = "btnJobPosition1";
            this.btnJobPosition1.Size = new Size(0x15, 0x15);
            this.btnJobPosition1.TabIndex = 60;
            this.btnJobPosition1.Text = "…";
            this.btnJobPosition1.UseVisualStyleBackColor = false;
            this.btnJobPosition1.Click += new EventHandler(this.btnJobPosition1_Click);
            this.JobPosition1.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.JobPosition1.BorderStyle = BorderStyle.FixedSingle;
            this.JobPosition1.Location = new Point(0x4b, 0x11);
            this.JobPosition1.Name = "JobPosition1";
            this.JobPosition1.Size = new Size(0x87, 0x15);
            this.JobPosition1.TabIndex = 0x3b;
            this.txtDate.CalendarMonthBackground = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.txtDate.Location = new Point(0x153, 0x7c);
            this.txtDate.Name = "txtDate";
            this.txtDate.Size = new Size(0x87, 0x15);
            this.txtDate.TabIndex = 0x3a;
            this.label2.AutoSize = true;
            this.label2.Location = new Point(280, 0x7e);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x35, 12);
            this.label2.TabIndex = 0x39;
            this.label2.Text = "下文时间";
            this.txtRemark.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.txtRemark.BorderStyle = BorderStyle.FixedSingle;
            this.txtRemark.Location = new Point(0x4a, 0xb2);
            this.txtRemark.Multiline = true;
            this.txtRemark.Name = "txtRemark";
            this.txtRemark.Size = new Size(400, 0x47);
            this.txtRemark.TabIndex = 0x38;
            this.label26.AutoSize = true;
            this.label26.Location = new Point(0x27, 180);
            this.label26.Name = "label26";
            this.label26.Size = new Size(0x1d, 12);
            this.label26.TabIndex = 0x37;
            this.label26.Text = "备注";
            this.txtSummary.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.txtSummary.BorderStyle = BorderStyle.FixedSingle;
            this.txtSummary.Location = new Point(0x4a, 0x97);
            this.txtSummary.Name = "txtSummary";
            this.txtSummary.Size = new Size(400, 0x15);
            this.txtSummary.TabIndex = 0x36;
            this.label25.AutoSize = true;
            this.label25.Location = new Point(0x27, 0x99);
            this.label25.Name = "label25";
            this.label25.Size = new Size(0x1d, 12);
            this.label25.TabIndex = 0x35;
            this.label25.Text = "摘要";
            this.txtNo.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.txtNo.BorderStyle = BorderStyle.FixedSingle;
            this.txtNo.Location = new Point(0x4a, 0x7c);
            this.txtNo.Name = "txtNo";
            this.txtNo.Size = new Size(0x87, 0x15);
            this.txtNo.TabIndex = 0x34;
            this.label24.AutoSize = true;
            this.label24.Location = new Point(15, 0x80);
            this.label24.Name = "label24";
            this.label24.Size = new Size(0x35, 12);
            this.label24.TabIndex = 0x33;
            this.label24.Text = "任职文号";
            this.txtAdminPosition.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.txtAdminPosition.BorderStyle = BorderStyle.FixedSingle;
            this.txtAdminPosition.Location = new Point(0x4a, 0x61);
            this.txtAdminPosition.Name = "txtAdminPosition";
            this.txtAdminPosition.Size = new Size(400, 0x15);
            this.txtAdminPosition.TabIndex = 50;
            this.label34.AutoSize = true;
            this.label34.Location = new Point(0x11, 0x63);
            this.label34.Name = "label34";
            this.label34.Size = new Size(0x35, 12);
            this.label34.TabIndex = 0x31;
            this.label34.Text = "行政职务";
            this.jpd2.CalendarMonthBackground = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.jpd2.Location = new Point(0x153, 0x2b);
            this.jpd2.Name = "jpd2";
            this.jpd2.Size = new Size(0x87, 0x15);
            this.jpd2.TabIndex = 0x30;
            this.label32.AutoSize = true;
            this.label32.Location = new Point(0x106, 0x31);
            this.label32.Name = "label32";
            this.label32.Size = new Size(0x47, 12);
            this.label32.TabIndex = 0x2f;
            this.label32.Text = "任职务2时间";
            this.label33.AutoSize = true;
            this.label33.Location = new Point(0x21, 0x2f);
            this.label33.Name = "label33";
            this.label33.Size = new Size(0x23, 12);
            this.label33.TabIndex = 0x2d;
            this.label33.Text = "职务2";
            this.jpdate1.CalendarMonthBackground = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.jpdate1.Location = new Point(0x153, 15);
            this.jpdate1.Name = "jpdate1";
            this.jpdate1.Size = new Size(0x87, 0x15);
            this.jpdate1.TabIndex = 0x2c;
            this.label31.AutoSize = true;
            this.label31.Location = new Point(0x106, 0x15);
            this.label31.Name = "label31";
            this.label31.Size = new Size(0x47, 12);
            this.label31.TabIndex = 0x2b;
            this.label31.Text = "任职务1时间";
            this.label29.AutoSize = true;
            this.label29.Location = new Point(0x21, 0x13);
            this.label29.Name = "label29";
            this.label29.Size = new Size(0x23, 12);
            this.label29.TabIndex = 14;
            this.label29.Text = "职务1";
            this.label27.AutoSize = true;
            this.label27.Location = new Point(0x11, 0x48);
            this.label27.Name = "label27";
            this.label27.Size = new Size(0x35, 12);
            this.label27.TabIndex = 0;
            this.label27.Text = "职务类型";
            this.groupBox1.Controls.Add(this.txtID);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.txtUsername);
            this.groupBox1.Controls.Add(this.label8);
            this.groupBox1.ForeColor = SystemColors.WindowText;
            this.groupBox1.Location = new Point(12, 0x27);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0x1fd, 0x33);
            this.groupBox1.TabIndex = 5;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "基本信息";
            this.txtID.BackColor = Color.WhiteSmoke;
            this.txtID.BorderStyle = BorderStyle.FixedSingle;
            this.txtID.ForeColor = SystemColors.ControlDarkDark;
            this.txtID.Location = new Point(0x153, 0x11);
            this.txtID.Name = "txtID";
            this.txtID.ReadOnly = true;
            this.txtID.Size = new Size(0x87, 0x15);
            this.txtID.TabIndex = 13;
            this.label1.AutoSize = true;
            this.label1.Location = new Point(280, 0x15);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x35, 12);
            this.label1.TabIndex = 12;
            this.label1.Text = "身份证号";
            this.txtUsername.BackColor = Color.WhiteSmoke;
            this.txtUsername.BorderStyle = BorderStyle.FixedSingle;
            this.txtUsername.ForeColor = SystemColors.ControlDarkDark;
            this.txtUsername.Location = new Point(0x4a, 0x11);
            this.txtUsername.Name = "txtUsername";
            this.txtUsername.ReadOnly = true;
            this.txtUsername.Size = new Size(0x87, 0x15);
            this.txtUsername.TabIndex = 11;
            this.label8.AutoSize = true;
            this.label8.Location = new Point(0x27, 0x15);
            this.label8.Name = "label8";
            this.label8.Size = new Size(0x1d, 12);
            this.label8.TabIndex = 10;
            this.label8.Text = "姓名";
            this.btnCancel.BackColor = Color.White;
            this.btnCancel.FlatStyle = FlatStyle.Popup;
            this.btnCancel.Location = new Point(0x15f, 390);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(0x4b, 0x17);
            this.btnCancel.TabIndex = 9;
            this.btnCancel.Text = "关闭";
            this.btnCancel.UseVisualStyleBackColor = false;
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
            this.btnSave.BackColor = Color.White;
            this.btnSave.FlatStyle = FlatStyle.Popup;
            this.btnSave.Location = new Point(0x93, 390);
            this.btnSave.Name = "btnSave";
            this.btnSave.Size = new Size(0x4b, 0x17);
            this.btnSave.TabIndex = 8;
            this.btnSave.Text = "保存";
            this.btnSave.UseVisualStyleBackColor = false;
            this.btnSave.Click += new EventHandler(this.btnSave_Click);
            this.lbTitle.BackColor = Color.Gold;
            this.lbTitle.Dock = DockStyle.Top;
            this.lbTitle.Font = new Font("宋体", 14.25f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
            this.lbTitle.ForeColor = Color.Black;
            this.lbTitle.Location = new Point(0, 0);
            this.lbTitle.Name = "lbTitle";
            this.lbTitle.Size = new Size(0x216, 0x1f);
            this.lbTitle.TabIndex = 0x39;
            this.lbTitle.Text = "人员任职";
            this.lbTitle.TextAlign = ContentAlignment.MiddleCenter;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            this.BackColor = Color.FromArgb(0xa4, 0xc4, 0xeb);
            base.ClientSize = new Size(0x216, 0x1ac);
            base.Controls.Add(this.lbTitle);
            base.Controls.Add(this.btnCancel);
            base.Controls.Add(this.btnSave);
            base.Controls.Add(this.groupBox1);
            base.Controls.Add(this.groupBox3);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "FrmJobPositionUpdate";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "人员任职";
            base.Load += new EventHandler(this.FrmJobTitleUpdate_Load);
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            base.ResumeLayout(false);
        }
    }
}

